/*
 * @Author: daifen
 * @Date: 2020-10-29 17:06:50
 * @LastEditors: daifen
 */
var mongoose = require('../../mongodb');
var FileDataResult = require("../fileDataResult/fileDataResult");

/**
 * @Desc: 根据fileDataId查询
 * @Author: daifen
 * @Date: 2020-10-30 11:24:57
 * @param {*}
 * @return {*}
 */
function getResultByDataId(fileDataId) {
    return new Promise(resolve => { 
        console.log(fileDataId,"fileDataId")
        FileDataResult.find({fileDataId:fileDataId }, function (err, res) {
            if (err) {
                resolve(err);
                return err
            }
            else {
                resolve(res);
                return res
            }
        })
    })
}

/**
 * @Desc: 更新确认结果
 * @Author: daifen
 * @Date: 2020-10-30 16:04:26
 * @param {*} wherestr = {'username' : 'Tracy McGrady'}; updatestr = {'userpwd': 'zzzz'};
 * @return {*}
 */
function updateResult(olddata, newdata) {
    var wherestr = olddata;
    var updatestr = newdata;

    return new Promise(resolve => {
        FileDataResult.update(wherestr, updatestr, function (err, res) {
            if (err) {
                resolve(err);
                return err
            }
            else {
                resolve(res);
                return res
            }
        })
    })

}




export {
    getResultByDataId,
    updateResult
}